import Taro from '@tarojs/taro'
import {View} from '@tarojs/components'
import {connect} from "@tarojs/redux";

import './index.less'

@connect(state => ({
  pca: state.pca,
}))
export default class SearchBar extends Taro.Component {

  navigateTo = url => {
    Taro.navigateTo({url: url})
  }

  render() {
    const {pca: {selectedPcaNode}} = this.props;

    return (
      <View className='search-wrapper'>
        <View className="location" onClick={this.navigateTo.bind(this, `/pages/pca_for_query/index`)}>
          <Text className="iconfont icon-locationfill"/>
          <Text className="text">{selectedPcaNode.name}</Text>
        </View>
        <View className='search' onClick={this.navigateTo.bind(this, `/pages/search_project/index`)}>
          <Text className="iconfont icon-search"/>
          <Text className='text'>查找您感兴趣的项目</Text>
        </View>
      </View>
    )
  }
}
